﻿CREATE VIEW reports.v_CompareToUsix
AS
SELECT     reports.v_DemographicsCompare.[Customer #], reports.v_DemographicsCompare.CompanyID, reports.v_DemographicsCompare.[Status Code], 
                      reports.v_DemographicsCompare.LoanID, reports.v_DemographicsCompare.FirstName, reports.v_DemographicsCompare.NameFirst, 
                      reports.v_DemographicsCompare.FN_X, reports.v_DemographicsCompare.LastName, reports.v_DemographicsCompare.NameLast, 
                      reports.v_DemographicsCompare.LN_X, reports.v_DemographicsCompare.SSN, reports.v_DemographicsCompare.[Primary SSN], 
                      reports.v_DemographicsCompare.SSN_X, reports.v_DemographicsCompare.PhoneHome, reports.v_DemographicsCompare.[Home Phone #], 
                      reports.v_DemographicsCompare.Phone_X, reports.v_DemographicsCompare.Street, reports.v_DemographicsCompare.Address, 
                      reports.v_DemographicsCompare.StreetMatch, reports.v_DemographicsCompare.Street_X, reports.v_DemographicsCompare.CityName, 
                      reports.v_DemographicsCompare.City, reports.v_DemographicsCompare.City_X, reports.v_DemographicsCompare.StateCode, 
                      reports.v_DemographicsCompare.St, reports.v_DemographicsCompare.State_X, reports.v_DemographicsCompare.Zip, 
                      reports.v_DemographicsCompare.[Zip Code], reports.v_DemographicsCompare.Zip_X, reports.v_DemographicsCompare.VIN, 
                      reports.v_DemographicsCompare.Serial#, reports.v_DemographicsCompare.B_DateStamp AS Brw_Date, 
                      reports.v_DemographicsCompare.C_DateStamp AS Car_Date, reports.v_DemographicsCompare.A_DateStamp AS Adr_Date, 
                      DataMining.dbo.COD_Address.Date AS U_Adr_Date, DataMining.dbo.COD_Address.Remark AS U_Adr_Remark, 
                      DataMining.dbo.COD_City.Date AS U_City_Date, DataMining.dbo.COD_City.Remark AS U_City_Remark, 
                      DataMining.dbo.COD_Phone.Date AS U_Ph_Date, DataMining.dbo.COD_Phone.Remark AS U_Ph_Remark, 
                      DataMining.dbo.COD_SSN.Date AS U_SSN_Date, DataMining.dbo.COD_SSN.Remark AS U_SSN_Remark, 
                      DataMining.dbo.COD_State.Date AS U_State_Date, DataMining.dbo.COD_State.Remark AS U_State_Remark, 
                      DataMining.dbo.COD_Zip.Date AS U_Zip_Date, DataMining.dbo.COD_Zip.Remark AS U_Zip_Remark
FROM         reports.v_DemographicsCompare LEFT OUTER JOIN
                      DataMining.dbo.COD_Zip ON reports.v_DemographicsCompare.[Customer #] = DataMining.dbo.COD_Zip.[Id #] AND 
                      reports.v_DemographicsCompare.CompanyID = DataMining.dbo.COD_Zip.CompanyID LEFT OUTER JOIN
                      DataMining.dbo.COD_State ON reports.v_DemographicsCompare.[Customer #] = DataMining.dbo.COD_State.[Id #] AND 
                      reports.v_DemographicsCompare.CompanyID = DataMining.dbo.COD_State.CompanyID LEFT OUTER JOIN
                      DataMining.dbo.COD_SSN ON reports.v_DemographicsCompare.[Customer #] = DataMining.dbo.COD_SSN.[Id #] AND 
                      reports.v_DemographicsCompare.CompanyID = DataMining.dbo.COD_SSN.CompanyID LEFT OUTER JOIN
                      DataMining.dbo.COD_City ON reports.v_DemographicsCompare.[Customer #] = DataMining.dbo.COD_City.[Id #] AND 
                      reports.v_DemographicsCompare.CompanyID = DataMining.dbo.COD_City.CompanyID LEFT OUTER JOIN
                      DataMining.dbo.COD_Phone ON reports.v_DemographicsCompare.[Customer #] = DataMining.dbo.COD_Phone.[Id #] AND 
                      reports.v_DemographicsCompare.CompanyID = DataMining.dbo.COD_Phone.CompanyID LEFT OUTER JOIN
                      DataMining.dbo.COD_Address ON reports.v_DemographicsCompare.[Customer #] = DataMining.dbo.COD_Address.[Id #] AND 
                      reports.v_DemographicsCompare.CompanyID = DataMining.dbo.COD_Address.CompanyID

GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[40] 4[20] 2[20] 3) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1[50] 4[25] 3) )"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1[27] 4) )"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 9
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "COD_Address (DataMining.dbo)"
            Begin Extent = 
               Top = 488
               Left = 591
               Bottom = 596
               Right = 742
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "COD_City (DataMining.dbo)"
            Begin Extent = 
               Top = 366
               Left = 587
               Bottom = 474
               Right = 738
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "COD_Phone (DataMining.dbo)"
            Begin Extent = 
               Top = 255
               Left = 592
               Bottom = 363
               Right = 743
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "COD_SSN (DataMining.dbo)"
            Begin Extent = 
               Top = 140
               Left = 590
               Bottom = 248
               Right = 741
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "COD_State (DataMining.dbo)"
            Begin Extent = 
               Top = 26
               Left = 590
               Bottom = 134
               Right = 741
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "COD_Zip (DataMining.dbo)"
            Begin Extent = 
               Top = 178
               Left = 348
               Bottom = 286
               Right = 499
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "v_DemographicsCompare (reports)"
            Begin Extent = 
               Top', @level0type = N'SCHEMA', @level0name = N'reports', @level1type = N'VIEW', @level1name = N'v_CompareToUsix';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane2', @value = N'= 218
               Left = 139
               Bottom = 631
               Right = 290
            End
            DisplayFlags = 280
            TopColumn = 12
         End
      End
   End
   Begin SQLPane = 
      PaneHidden = 
   End
   Begin DataPane = 
      PaneHidden = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1440
         Alias = 2010
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'reports', @level1type = N'VIEW', @level1name = N'v_CompareToUsix';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 2, @level0type = N'SCHEMA', @level0name = N'reports', @level1type = N'VIEW', @level1name = N'v_CompareToUsix';

